let path = require('path');
let HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports =  {
    // production
    mode: 'development',
    entry: {
        index: './src/index.js',
        saber: './src/saber.js'
    },
    output: {
        // [name][hash:8].js
        filename: '[name].js',
        path: path.resolve('dist')
    },
    devServer: {
        port: 9999,
        progress: true,
        //对外提供的访问内容的路径
        contentBase: 'dist',
        //是否启用gzip压缩
        compress: true
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: './public/index.html',
            filename: 'index.html',
            favicon: './public/Pokeball.ico',
            hash: false,
            cache: true,
            minify: {
                removeAttributeQuotes: true,
                collapseWhitespace: true        
            },
            chunks:['index'],
            // excludeChunks: ['index']
        }),
        new HtmlWebpackPlugin({
            template: './public/saber.html',
            filename: 'saber.html',
            excludeChunks: ['index']
        })
    ]
}